/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.mphokazi.designpatterns.part1.behavioral.memento;

/**
 *
 * @author mphokazi
 */
public class DietInfor {
    String personName;
    int dayNumber;
    int weightl;
    
    public DietInfor(String personName,int dayNumber,int weightl)
    {
        this.dayNumber=dayNumber;
        this.personName=personName;
        this.weightl = weightl;
    }
    public String toString()
    {
        return "name"+personName+"Day number"+dayNumber+"weight:"+weightl;
    }
    public void setDayNumberAndWeight(int dayNumber,int weightl)
    {
        this.dayNumber =dayNumber;
        this.weightl = weightl;
    }
    public Memento save()
    {
        return new Memento(personName ,dayNumber,weightl);
    }
    public void restore(Object objMemento)
    {
        Memento memento =(Memento)objMemento;
        personName = memento.mementoPersonName;
        dayNumber =memento.mementoDayNumber;
        weightl = memento.mementoWeight;
        
    }
    
    private class Memento{
        
        String mementoPersonName;
        int mementoDayNumber;
        int mementoWeight;
        public Memento(String personName,int dayNumber,int weightl){
         mementoPersonName = personName;
         mementoDayNumber = dayNumber;
         mementoWeight =    weightl;
    }
    }
}
